package com.business_clean.ui.adapter;

import android.graphics.Color;
import android.widget.TextView;

import com.business_clean.R;
import com.business_clean.data.initconfig.MenuEntity;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

public class BaseMenuAdapter extends BaseQuickAdapter<MenuEntity, BaseViewHolder> {

    public BaseMenuAdapter() {
        super(R.layout.item_menu_grid);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, MenuEntity menuEntity) {
        holder.setText(R.id.tv_item_statistics_num, menuEntity.getNum())
                .setText(R.id.tv_item_statistics_title, menuEntity.getTitle())
                .setText(R.id.tv_item_statistics_sub, menuEntity.getSub());

        //根据特殊情况给颜色
        TextView num = holder.getView(R.id.tv_item_statistics_num);
        if ("0".equals(menuEntity.getNum())) {
            num.setTextColor(Color.parseColor("#8D8E99"));
        } else {
            num.setTextColor(Color.parseColor(menuEntity.getColor()));
        }
    }
}
